home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_Patterns / PatternApp.h < prev    next >
Text File  |  1992-12-19  |  4KB  |  154 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    PatternApp.h
  35.  *
  36.  *    This class performs some of the global functions necessary to start
  37.  *    the application. The drawing window is created here.
  38.  *
  39.  *    Version:    2.0
  40.  *    Author:    Ken Fromm
  41.  *    History:
  42.  *            03-07-91        Added this comment.
  43.  */
  44.  
  45. #import <appkit/Application.h>
  46. #import <appkit/View.h>
  47.  
  48. #define  CIRCLESTAR        0
  49. #define  OCTAGON        1
  50. #define  BRICK            2
  51. #define  WEAVE            3
  52. #define  NUM_PATTERNS    4
  53.  
  54. #define  STROKE            0
  55. #define  FILL                1
  56. #define  TEXT                2
  57.  
  58. /*
  59. *    These values determine how the pattern
  60. *    will be displayed.  Each places a clipping path
  61. *    around the path to be filled.
  62. *
  63. *    The draw method draws each cell each time.
  64. *    It is not the preferred method. (The font method
  65. *    should be used instead.)
  66. *
  67. *    The font method builds a character for each
  68. *    color (layer) in the pattern. The characters are
  69. *    then drawn a layer at a time. Its faster than the
  70. *    first method because the characters are cached
  71. *    in the font cache.
  72. *
  73. *    The composite method creates an image
  74. *    and then tiles the image through the path.
  75. *    An advantage here is that only one pass is
  76. *    necessary even with multicolored patterns.
  77. *    Unfortunately, it cannot be used for printing.
  78. *
  79. *    It turns out that a big performance win is gained
  80. *    if the cell size is increased from a single image
  81. *    into a cell with multiple images. Care must be
  82. *    taken though to insure proper alignment of the
  83. *    images within the cells.
  84. */
  85. #define  TYPE_DRAW            0
  86. #define  TYPE_FONT            1
  87. #define  TYPE_COMP            2
  88.  
  89. /*
  90. *    These values lock the pattern to either the window or the view.
  91. *
  92. *    If locked to the window, the changes produced by scrolling
  93. *    are handled by a currenthalftonephase transtation (see the
  94. *    PATthtp procedure in PatternDict). Resizing of the window or
  95. *    changes in the placement of the view within the window may
  96. *    cause shifts in the pattern tiling.
  97. *
  98. *    Locking to the view eliminates the shifts of the pattern tiling
  99. *    when the window is resized or when the view is moved within
  100. *    the window. In the case of LOCK_VIEW, the size of the
  101. *    pattern cell remains unchanged at any scale of the view. In
  102. *    the case of LOCK_VIEWSCALE, the pattern cell scales to
  103. *    reflect the scale of the drawing view.
  104. *
  105. *    Level 2 patterns will most likely be handled like the first case.
  106. *    If the behavior of either of the last two cases is desired then
  107. *    the pattern will have to be remade when the window resizes,
  108. *    the view is moved or the scale changes.
  109. */
  110. #define  LOCK_WINDOW        0
  111. #define  LOCK_VIEW            1
  112. #define  LOCK_VIEWSCALE    2
  113.  
  114. #define SCROLLVIEW_BORDER        NX_NOBORDER
  115.  
  116. @interface PatternApp : Application
  117. {
  118.     id    countMatrix,
  119.         graphicsMatrix,
  120.         patternMatrix,
  121.         timingMatrix,
  122.         typeMatrix,
  123.         lockMatrix,
  124.         zoomMatrix,
  125.         patternBox,
  126.  
  127.         drawingviewId,        /* the drawing view */
  128.         windowId;            /* the window the views above are in */
  129. }
  130.  
  131. - createWindow:(NXRect *) winRect;
  132.  
  133. - free;
  134.  
  135. - countMatrix;
  136. - graphicsMatrix;
  137. - patternMatrix;
  138. - timingMatrix;
  139. - typeMatrix;
  140. - lockMatrix;
  141. - zoomMatrix;
  142.  
  143. - patternBox;
  144.  
  145. - drawingView;
  146. - docView;
  147.  
  148. - appDidInit:sender;
  149.  
  150. - windowDidResize:sender;
  151.  
  152. @end
  153.  
  154.